home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-05-21 | 1.0 KB | 44 lines | [TEXT/ttxt] |
- ---<<<
-
- module EmbeddedBouncingBall
- uses ScriptX, WebBrowserInterface
- exports bounceApplet, startEmbeddedTitle
- end
-
- in module EmbeddedBouncingBall
-
- class bounceApplet (WebApplet)
- instance variables
- mySpace
- end
-
- class ball (TwoDShape, Projectile)
- end
-
- method init self {object bounceApplet} #rest args #key parent: -> (
- apply nextmethod self args
- self.mySpace := new TwoDSpace boundary: (copy parent.bbox) stroke: blackbrush
- append parent self.mySpace
- local ballcolor := new brush color:(new rgbcolor red:0 green:200 blue:0) \
- pattern:blackPattern
- local shp := new ball target:(new oval x1:0 y1:0 x2:20 y2:20) \
- fill:ballcolor stroke:undefined
- shp's x := 50;
- shp's y := 50;
- shp's elasticity := 1
- append self.mySpace shp
- shp's velocity := (new point x:-8.0 y:4.0)
-
- local g := new gravity space: self.mySpace
- local m := new movement space: self.mySpace
- local b := new bounce space: self.mySpace
-
- append b shp
- append m shp
- -- append g shp
- )
-
- function startEmbeddedTitle tc -> foreach tc load undefined
-
- --->>>
-